package com.shqcjd.preinstallmobile.util;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.shqcjd.preinstallmobile.R;

/**
 * Created by sy on 2019/4/13.
 */

public class Glideutil {
    public static void loadImag(Context context, ImageView view, String url,int width,int height){
        RequestOptions options = new RequestOptions()
                .placeholder(R.mipmap.ic_default_small)	//加载成功之前占位图
                .error(R.mipmap.ic_default_small)	//加载错误之后的错误图
                .override(width,height)	//指定图片的尺寸
                .centerCrop();//指定图片的缩放类型为centerCrop （等比例缩放图片，直到图片的宽高都
        Glide.with(context)
                .load(url)
                .apply(options)
                .into(view);
    }
}
